#ifndef ITEM_H
#define ITEM_H



#include "models_global.h"
#include "AbstractItem.h"



#include <QSharedData>
#include <QSharedDataPointer>



//static const QString ITEM_NAME = QT_TRANSLATE_NOOP("Item", "Item");



class MODELSSHARED_EXPORT Item : public AbstractItem
{
    Q_OBJECT

    class Data : public QSharedData
    {
    public:
        Data() {}
        Data(const Data& other) : QSharedData(other)
        {
            value = other.value;
        }

        QVariant value;
    };


public:

    enum DataType
    {
        DataType_FIRST = AbstractItem::CustomData,

        ValueData = DataType_FIRST,

        DataType_LAST = ValueData
    };

    Item(AbstractItem* parent = 0);
    Item(const QString& name, AbstractItem* parent = 0);

    //void setData(const int &, const QVariant &);
    //QVariant data(const int &) const;

    virtual int fieldCount() const;
    virtual QString fieldName(const int &data_type) const;
    virtual int field(const QString &field_name) const;


    QVariant value() const;
    void setValue(const QVariant& value);

    //QVariant bonus() const = 0;
    QVariant bonus() const { return QVariant(); }


protected:

    virtual void setCustomData(const int &data_type, const QVariant &data);
    virtual QVariant customData(const int &data_type) const;


private:

    //virtual void addChild(AbstractItem *) {}

    QSharedDataPointer<Data> d;



};




#endif // ITEM_H
